package com.dog.basics.security.exception;
import com.dog.basics.common.constant.CommonConstants;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.AuthenticationException;

/**
 */
public abstract class BaseDogAuth2Exception extends AuthenticationException {

	/**
	 * 错误代码
	 */
	private int code;

	/**
	 * 内容信息
	 */
	private Object data;

	public BaseDogAuth2Exception(String msg) {
		super(msg);
		this.code = CommonConstants.FAIL;
	}

	public BaseDogAuth2Exception(String msg, int code,Object data) {
		super(msg);
		this.code = code;
		this.data = data;
	}

	public int getHttpErrorCode() {
		// 400 not 401
		return HttpStatus.BAD_REQUEST.value();
	}

	public int getCode() {
		return this.code;
	}
	public Object getDate() {
		return this.data;
	}
	public abstract String getOAuth2ErrorCode();
}
